home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / EmptyBorder.java < prev    next >
Text File  |  1998-06-30  |  3KB  |  92 lines

  1. /*
  2.  * @(#)EmptyBorder.java    1.15 98/02/02
  3.  *
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  *
  19.  */
  20. package com.sun.java.swing.border;
  21.  
  22. import java.awt.Graphics;
  23. import java.awt.Insets;
  24. import java.awt.Rectangle;
  25. import java.awt.Component;
  26. import java.io.Serializable;
  27.  
  28. /**
  29.  * A class which provides an empty, transparent border which
  30.  * takes up space but does no drawing.
  31.  * <p>
  32.  * Warning: serialized objects of this class will not be compatible with
  33.  * future swing releases.  The current serialization support is appropriate 
  34.  * for short term storage or RMI between Swing1.0 applications.  It will
  35.  * not be possible to load serialized Swing1.0 objects with future releases
  36.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  37.  * baseline for the serialized form of Swing objects.
  38.  *
  39.  * @version 1.15 02/02/98
  40.  * @author David Kloba
  41.  */
  42. public class EmptyBorder extends AbstractBorder implements Serializable
  43. {
  44.     protected int left, right, top, bottom;
  45.  
  46.     /**
  47.      * Creates an empty border with the specified insets.
  48.      * @param top the top inset of the border
  49.      * @param left the left inset of the border
  50.      * @param bottom the bottom inset of the border
  51.      * @param right the right inset of the border
  52.      */
  53.     public EmptyBorder(int top, int left, int bottom, int right)   {
  54.         this.top = top; 
  55.         this.right = right;
  56.         this.bottom = bottom;
  57.         this.left = left;
  58.     }
  59.  
  60.     /**
  61.      * Creates an empty border with the specified insets.
  62.      * @param insets the insets of the border
  63.      */
  64.     public EmptyBorder(Insets insets)   {
  65.         this.top = insets.top; 
  66.         this.right = insets.right;
  67.         this.bottom = insets.bottom;
  68.         this.left = insets.left;
  69.     }
  70.  
  71.     /**
  72.      * Does no drawing by default.
  73.      */
  74.     public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  75.     }
  76.  
  77.     /**
  78.      * Returns the insets of the border.
  79.      * @param c the component for which this border insets value applies
  80.      */
  81.     public Insets getBorderInsets(Component c)       {
  82.         return new Insets(top, left, bottom, right);
  83.     }
  84.  
  85.     /**
  86.      * Returns whether or not the border is opaque.
  87.      * Returns false by default.
  88.      */
  89.     public boolean isBorderOpaque() { return false; }
  90.  
  91. }
  92.